package de.dlrg.wms.controller.controllers;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import wms2010.interfaces.devices.IDevice;

import de.dlrg.wms.interfaces.controller.IDeviceController;

@Component
public class ConnectivityDeviceController {
	@Autowired
	private List<IDeviceController> listOfDeviceContorller;
	
	public List<IDeviceController> readAll() {
		return this.listOfDeviceContorller;
	}

	public void setStarter(IDevice device) {
		device.setStarter(true);
		for(IDeviceController deviceController : this.listOfDeviceContorller) {
			for(IDevice otherDevice : deviceController.getAllDevices()) {
				otherDevice.setStarter(false);
			}
		}
	}
	
	public void removeStarter(IDevice device) {
		device.setStarter(false);
	}
}
